package com.zmn.uac.common.enums;

import com.zmn.uac.common.constant.AccessTypeConstant;

import java.util.Objects;

/**
 * 类描述：店铺枚举
 *
 * @author xujie
 * @since 2021/05/18 18:34
 */
public enum AccessTypeEnum {

    /**
     * 店铺
     */
    SHOP(AccessTypeConstant.SHOP, "店铺"),
    /**
     * 品牌 品牌站
     */
    BRAND_STAND(AccessTypeConstant.BRAND_STAND, "品牌站");

    /**
     * 键
     */
    private final Integer key;

    /**
     * 值
     */
    private final String value;

    AccessTypeEnum(Integer key, String value) {

        this.key = key;
        this.value = value;
    }

    public Integer getKey() {
        return key;
    }

    public String getValue() {
        return value;
    }

    /**
     * 枚举校验
     *
     * @param key 键
     * @return boolean
     */
    public static boolean validate(Integer key) {

        for (AccessTypeEnum e : AccessTypeEnum.values()) {
            if (Objects.equals(e.getKey(), key)) {
                return true;
            }
        }
        return false;
    }

}
